__author__ = 'Dianlei Zhang'
from functools import reduce

def f(x):
    return x*x

r = map(f, [1, 2, 3])

print(list(r))

def add(x, y):
    return x + y

print(reduce(add, [1,2,3,4,5]))


def fn(x, y):
    return x*10 + y

print(reduce(fn, [1,2,3,4,5,7,5]))
